<template>
  <div>
    this is child
    <button @click="console.log(message)">{{ message }}</button>
  </div>
</template>

<script setup lang="ts">
import { inject, watch, ref } from 'vue'
import type { InjectType } from './type'

const { message } = inject<InjectType>('homeView') as unknown as any as InjectType

const currentMsg = ref('')

watch(message, (newVal, oldVal) => {
  currentMsg.value = newVal
})

console.log(message, '======')
</script>

<style scoped></style>
